package com.github.cloud.mobile;

import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.DefaultSecurityFilterChain;
import org.springframework.stereotype.Component;

/**
 * Created by guxiaowei on 2018/3/5.
 * 手机号登录配置入口
 */
@Component
public class MobileSecurityConfigurer extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {
//    @Autowired
//    private AuthenticationSuccessHandler mobileLoginSuccessHandler;
//    @Autowired
//    private UserService userService;
//
//    @Override
//    public void configure(HttpSecurity http) throws Exception {
//        MobileAuthenticationFilter mobileAuthenticationFilter = new MobileAuthenticationFilter();
//        mobileAuthenticationFilter.setAuthenticationManager(http.getSharedObject(AuthenticationManager.class));
//        mobileAuthenticationFilter.setAuthenticationSuccessHandler(mobileLoginSuccessHandler);
//
//        MobileAuthenticationProvider mobileAuthenticationProvider = new MobileAuthenticationProvider();
//        mobileAuthenticationProvider.setUserService(userService);
//        http.authenticationProvider(mobileAuthenticationProvider)
//                .addFilterAfter(mobileAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
//    }
}
